﻿using System;
using System.Collections.Generic;
using System.Linq;

using Fuse8.DomainFramework.Common;
using Fuse8.DomainFramework.BusinessService;

using Fuse8.ContentManagementFramework.Domain;
using Fuse8.ContentManagementFramework.Domain.Special;

namespace Fuse8.ContentManagementFramework.BizFacade.AdministrationServices
{
    public class CmsConfigurationItemService : BaseBusinessService<CmsConfigurationItem, int>
    {
        public IEnumerable<CmsConfigurationItem> GetConfigurationItemsForSite(int siteId)
        {
            var site = new CmsSite(siteId);

            return GetConfigurationItemsForSite(site);
        }

        public IEnumerable<CmsConfigurationItem> GetConfigurationItemsForSite(CmsSite site)
        {
            Guard.ArgumentNotNull(site, "site");

            return site.SiteConfigurationItems.Concat(site.SiteGroup.SiteGroupConfigurationItems);
        }
    }
}
